<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>用户管理</title>
	
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
				<c:if test="${action=='create'}">
					$("#roleId").focus();
				</c:if>
				<c:if test="${action=='update'}">
					$("#roleName").focus();
				</c:if>
			
			//为inputForm注册validate函数
			$("#inputForm").validate();
		});
	</script>
</head>

<body>
	<form id="inputForm" action="${ctx}/admin/roles/${action}" method="post" class="form-horizontal">
		
		<fieldset>
			<legend><small>用户管理</small></legend>
			<div class="control-group">
				<label class="control-label">角色代码:</label>
				<div class="controls">
					<c:if test="${action=='create'}">
					<input type="text" id="roleId" name="roleId" value="${roles.roleId}" class="input-large"  />
					</c:if>
					<c:if test="${action=='update'}">
					<input type="hidden" name="roleId" value="${roles.roleId}" />
					<input type="text" value="${roles.roleId}" class="input-large"  disabled="disabled"/>
					</c:if>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">角色名:</label>
				<div class="controls">
					<input type="text" id="name" name="roleName" value="${roles.roleName}" class="input-large required"/>
				</div>
			</div>
			<div class="form-actions">
				<input id="submit_btn" class="btn btn-primary" type="submit" value="提交"/>&nbsp;	
				<input id="cancel_btn" class="btn" type="button" value="返回" onclick="history.back()"/>
			</div>
		</fieldset>
	</form>
</body>
</html>
